package top.kaoshanji.p1ch02b.impl;

import top.kaoshanji.p1ch02b.exception.GreetException;
import top.kaoshanji.p1ch02b.GreetV1;

/**
 * author kaoshanji
 * ^_^
 * create time 2024/12/23 20:43
 */
public class GreetV1Impl implements GreetV1 {

    @Override
    public String greet(String name, String gender) throws GreetException {

        if (gender == null) {
            throw new GreetException("性别不能为空...");
        }

        return "<Greet V1>" + name + (gender.equals("男") ? " 先生" : " 女士");
    }
}
